package com.example.littleSpider.myapplication.adapter;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.StrikethroughSpan;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.littleSpider.myapplication.R;

import java.util.List;

/**
 * Created by littleSpider on 2017/12/20.
 */

public class MallAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    public MallAdapter(@LayoutRes int layoutResId, @Nullable List<String> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        String st_price = "¥99.00";
        SpannableString spannableString = new SpannableString(st_price);
        StrikethroughSpan strikethroughSpan = new StrikethroughSpan();
        spannableString.setSpan(strikethroughSpan, 0, st_price.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
//        TextView textView = helper.getView(R.id.tv_old_price);
        helper.setText(R.id.tv_old_price, spannableString);
    }
}
